package com.item.service.impl;

import com.github.pagehelper.PageHelper;
import com.item.domain.VideoOrderPay;
import com.item.mapper.VideoOrderPayMapper;
import com.item.service.VideoOrderPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VideoOrderPayServiceImpl implements VideoOrderPayService {

    @Autowired
    VideoOrderPayMapper videoOrderPayMapper;

    @Override
    public List<VideoOrderPay> findAll(int limit, int page, VideoOrderPay video) {
        if (limit > 0 && page > 0) {
            PageHelper.startPage(limit, page);
        }
        return videoOrderPayMapper.findAll(video);
    }

    @Override
    public int add(VideoOrderPay video) {
        return videoOrderPayMapper.insertSelective(video);
    }

    @Override
    public int update(VideoOrderPay video) {
        return videoOrderPayMapper.updateByPrimaryKeySelective(video);
    }

    @Override
    public int delete(int id) {
        return videoOrderPayMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int videoOrderDeleteDel(int id, int del) {
        VideoOrderPay videoOrderPay = new VideoOrderPay();
        videoOrderPay.setId(id);
        videoOrderPay.setDel(del);
        return videoOrderPayMapper.updateByPrimaryKeySelective(videoOrderPay);
    }


}
